package homework.office.coding;

public class Staff {
    private String name;
    private String sex;
    private Positon positon;
    private Department depatment;
    private int age;
    /**
     * 无参构造
     */
    public Staff(){

    }

    public Positon getPositon() {
        if (this.positon==null){
            this.positon=new Positon();
        }
        return positon;
    }

    public void setPositon(Positon positon) {
        this.positon = positon;
    }

    public Department getDepatment() {
        if (this.depatment==null){
            this.depatment=new Department();
        }
        return depatment;
    }

    public void setDepatment(Department depatment) {
        this.depatment = depatment;
    }

    public Staff(String name , String sex, Positon positon,Department depatment , int age){
        this.setAge(age);
        this.setName(name);

        this.setSex(sex);
        this.setDepatment(depatment);
        this.setPositon(positon);

    }
    public void  showInfo(){
//        return String.format("姓名：%s%n工号：%s%n性别：%s%n年龄：%d%n", this.getName(), this.getId(),this.getSex(),this.getAge());
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }



    public String getSex() {


        return sex;
    }

    public void setSex(String sex) {
        if (sex.equals("1")){
            this.sex="女";
        }else
        {this.sex = "男";}

    }


    public int getAge() {
        return age;
    }

    public void setAge(int age) {
      if (age<=18 || age>=60){
          this.age=18;
      }else{
          this.age=age;
      }
    }
}
